<!DOCTYPE html>
<html>
<head>
    <title>用户登录</title>
    <style>
        /* 设置全局字体和背景 */
        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            margin: 0;
            padding: 0;
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
        }

        /* 登录容器样式 */
        .login-container {
            background-color: rgba(255, 255, 255, 0.9);
            padding: 30px;
            border-radius: 10px;
            box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
            width: 350px;
            animation: fadeIn 0.5s ease-out;
        }

        /* 标题样式 */
        h2 {
            text-align: center;
            color: #333;
            margin-bottom: 20px;
            font-size: 24px;
        }

        /* 表单组样式 */
        .form-group {
            margin-bottom: 20px;
        }

        /* 标签样式 */
        label {
            display: block;
            margin-bottom: 8px;
            color: #666;
            font-size: 14px;
        }

        /* 输入框样式 */
        input[type="text"], input[type="password"] {
            width: 100%;
            padding: 12px;
            border: 1px solid #ccc;
            border-radius: 5px;
            box-sizing: border-box;
            transition: border-color 0.3s ease;
        }

        /* 输入框聚焦样式 */
        input[type="text"]:focus, input[type="password"]:focus {
            border-color: #764ba2;
            outline: none;
        }

        /* 按钮样式 */
        button {
            width: 100%;
            padding: 12px;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            border: none;
            border-radius: 5px;
            cursor: pointer;
            transition: background 0.3s ease;
        }

        /* 按钮悬停样式 */
        button:hover {
            background: linear-gradient(135deg, #5a6fc7 0%, #6a3d93 100%);
        }

        /* 错误消息样式 */
        .error-message {
            color: red;
            text-align: center;
            margin-bottom: 15px;
            font-size: 14px;
        }

        /* 注册链接样式 */
        .register-link {
            text-align: center;
            margin-top: 20px;
            font-size: 14px;
        }

        /* 注册链接超链接样式 */
        .register-link a {
            color: #764ba2;
            text-decoration: none;
            transition: color 0.3s ease;
        }

        /* 注册链接超链接悬停样式 */
        .register-link a:hover {
            color: #5a6fc7;
            text-decoration: underline;
        }

        /* 淡入动画 */
        @keyframes fadeIn {
            from {
                opacity: 0;
                transform: translateY(-20px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }
    </style>
</head>
<body>
<div class="login-container">
    <h2>Spring Boot 登录实验</h2>
    <!-- 显示错误消息 -->
    <div class="error-message" th:if="${param.error}">
        用户名或密码错误！
    </div>
    <!-- 登录表单 -->
    <form action="/doLogin" method="post">
        <div class="form-group">
            <label for="username">用户名:</label>
            <input type="text" id="username" name="username" required>
        </div>
        <div class="form-group">
            <label for="password">密码:</label>
            <input type="password" id="password" name="password" required>
        </div>
        <button type="submit">登录</button>
    </form>
    <!-- 注册链接 -->
    <div class="register-link">
        还没有账号？<a href="/register">立即注册</a>
    </div>
</div>
</body>
</html>